<?php
    class User{
        private $id = 0;
        private $name = "";
        private $username = "";
        private $password = "";
        private $email = "";
		private $roles = "";
        private $isSuper = false;
        private $updateDate = "";
        private $saveDate = "";
        
        public function setId($id){
        	$this->id = $id;
        }
		
		public function setName($name){
			$this->name = $name;
		}
		
		public function setUsername($user){
			$this->username = $user;
		}
		
		public function setPassword($pass){
			$this->password = $pass;
		}
		
		public function setEmail($mail){
			$this->email = $mail;
		}
		
		public function setRole($role){
			if($this->roles = ""){
				$this->roles = $role;
			}else{
				$this->roles = $this->roles . "," . $role;
			}
		}
		
		public function setSuper($isSuper){
			$this->isSuper = $isSuper;
		}
		
		public function setUpdateDate($date){
			$this->updateDate = $date;
		}
		
		public function setSaveDate($date){
			$this->saveDate = $date;
		}
		
		public function getId(){
			return $this->id;
		}
		
		public function getName(){
			return $this->name;
		}
		
		public function getUser(){
			return $this->username;
		}
		
		public function getPass(){
			return $this->password;
		}
		
		public function getEmail(){
			return $this->email;
		}
		
		public function getRoles(){
			return $this->roles;
		}
		
		public function isSuper(){
			if($this->isSuper){
				return 1;
			}else{
				return 0;
			}
		}
		
		public function getUpdateDate(){
			return $this->updateDate;
		}
		
		public function getSaveDate(){
			return $this->saveDate;
		}
		
		public function isThisRole($role){
			$array = explode(",", $this->roles, 2);
			
			while(isset($array[1])){
				if($array[0] == $role){
					return TRUE;
				}
				$array = explode(",", $array[1], 2);
			}
			
			if($array[0] == $role){
				return TRUE;
			}else{
				return FALSE;
			}
		}
    }

?>